import {removeTone} from "./tone-helper";

export function generateQuestion({lines}, trainFromError, userWeak) {
    const question = [];
    lines.forEach((line, row) => {
        line.forEach((word, column) => {
            if (word.yin.length > 0) {
                let rawYin = removeTone(word.yin);
                if(!trainFromError || userWeak[rawYin] > 0) {
                    question.push({
                        coordinate: [row, column],
                        yin: word.yin,
                        rawYin: rawYin,
                        xing: word.xing
                    });
                }

            }
        });
    });
    return question;
}
